/**
 * @file Intp_Finder.h
 * @brief 
 * @author Linhuo (1066117119@qq.com)
 * @version 1.0
 * @date 2021-06-09
 * 
 * @copyright Copyright (c) 2021  Linhuo
 */
#ifndef _PRO2_RESTRICT_FINDER_H_
#define _PRO2_RESTRICT_FINDER_H_
#include "Restric_Solver.h"

/**
 * @brief An enumeration of Restriction Function；
 * 		  FullWeighting 　= 　1；
 * 		　Injection 　= 　2；
*/
enum Logo_Restrict
{
    FullWeighting = 1,
    Injection = 2
};

class Restrict_Finder
{
private:
    Restrict_Solver *p_Intptype;

public:
    Restrict_Finder(enum Logo_Restrict _method_name, int _dim)
    {
        if (_method_name == FullWeighting && _dim == 1)
            p_Intptype = new Restrict_1D_FullWeighting();
        else if (_method_name == FullWeighting && _dim == 2)
            p_Intptype = new Restrict_2D_FullWeighting();
        else if (_method_name == Injection && _dim == 1)
            p_Intptype = new Restrict_1D_Injection();
        else if (_method_name == Injection && _dim == 2)
            p_Intptype = new Restrict_2D_Injection();
        else
        {
            std::cout << "Not Found !" << std::endl;
            p_Intptype = NULL;
        };
    };
    ~Restrict_Finder() { delete p_Intptype; };
     void Restrict_Reset(enum Logo_Restrict _method_name, int _dim)
    {
       if (_method_name == FullWeighting && _dim == 1)
            p_Intptype = new Restrict_1D_FullWeighting();
        else if (_method_name == FullWeighting && _dim == 2)
            p_Intptype = new Restrict_2D_FullWeighting();
        else if (_method_name == Injection && _dim == 1)
            p_Intptype = new Restrict_1D_Injection();
        else if (_method_name == Injection && _dim == 2)
            p_Intptype = new Restrict_2D_Injection();
        else
        {
            std::cout << "Not Found !" << std::endl;
            p_Intptype = NULL;
        };
    };
    VectorXd Restrict(VectorXd _r)
    {
        return p_Intptype->Restrict(_r);
    };
};
#else
//DO NOTHING
#endif